package com.cu.simpleerp.system.controller;

import com.cu.simpleerp.frame.session.SessionManagerUtil;
import com.cu.simpleerp.system.model.User;
import com.cu.simpleerp.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author jintian
 * @date 2018/10/31 17:49
 */
@Controller
public class SystemController {

    @Autowired
    private SystemService systemService;

    @RequestMapping("index")
    public String index(Map<String,Object> map, HttpServletRequest request){
        User loginUser = SessionManagerUtil.getLoginUser(request);
        map.put("userName",loginUser.getUserName());
        map.put("userImage",loginUser.getImageUrl());
        map.put("systemName","测试");
        map.put("systemUrl","http://127.0.0.1:8081/static/login.html");
        map.put("menus",systemService.getMenu(loginUser.getId()));
        return "index";
    }
}
